import time

from selenium.webdriver.common.by import By

from common.Utils import ForumDriver
#论坛个人中心详情页用例
class ForumPrivate:
    url = ""
    driver = ""
    def __init__(self):
        self.url = "http://127.0.0.1:9580/index.html"
        self.driver = ForumDriver.driver
        self.driver.get(self.url)
    #测试个人中心详情页(登录情况下）
    def ModifySucTest(self):
        self.driver.find_element(By.CSS_SELECTOR,"#index_nav_avatar").click()
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_settings").click()
        #进入个人中心详情页
        #修改头像
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div > div.col.d-flex.flex-column > div > div.row.align-items-center > div:nth-child(2) > a").send_keys("C:\\Users\\86135\\Desktop\\C++.png")

        #修改昵称
        self.driver.find_element(By.CSS_SELECTOR,"#setting_input_nickname").clear()
        self.driver.find_element(By.CSS_SELECTOR,"#setting_input_nickname").send_keys("ChenYiQi")
        self.driver.find_element(By.CSS_SELECTOR,"#setting_submit_nickname")
        # 添加屏幕截图
        ForumDriver.getScreeShot()

        #修改邮箱地址
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_email").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_email").send_keys("22222222")
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_email")
        # 添加屏幕截图
        ForumDriver.getScreeShot()

        #修改电话号码
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_phoneNum").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_phoneNum").send_keys("11111111")
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_phoneNum")
        # 添加屏幕截图
        ForumDriver.getScreeShot()

        #修改密码
        self.driver.find_element(By.CSS_SELECTOR,"#settings_input_oldPassword").send_keys("123456789")
        self.driver.find_element(By.CSS_SELECTOR,"#settings_input_newPassword").send_keys("123")
        self.driver.find_element(By.CSS_SELECTOR,"#settings_input_passwordRepeat").send_keys("123")
        # self.driver.find_element(By.CSS_SELECTOR,"#settings_submit_password").click()
        # # 添加屏幕截图
        ForumDriver.getScreeShot()

        #修改个人简历
        self.driver.find_element(By.CSS_SELECTOR, "#settings_textarea_remark").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_textarea_remark").send_keys("你好")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_remark")
        # 添加屏幕截图
        ForumDriver.getScreeShot()
        time.sleep(2)